<?php session_start();?>

<?php if(isset($_SESSION['user'])){  

$year=$_POST['sltYr'];
$subgr=$_POST['sltSubgr'];
$user=$_SESSION['user'];
    
 include'../admin/logic/Classes/db.php'; 

        $x=new Dbconnect();
	
	    $con=$x->getConnection();
		 
 //getting emplyee or registration number using User name
$result3=mysql_query("select emp_reg from login where u_name='$user'",$con);
		
while($row3=mysql_fetch_array($result3)){
$emp_reg=$row3['emp_reg'];
}
		 
//getting student name using Registration number
		 
$result2=mysql_query("select reg_no from student where reg_no='$emp_reg'",$con);
		 
while($row2=mysql_fetch_array($result2)){
$reg=$row2['reg_no'];
$num=mysql_num_rows($result2);
}
		 
?>			
<html>
<head>
<title>Students Annual Progress of Subjects</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
	font-family: Cambria;
	color: #000080;
}
.style2 {color: #000099}
.style3 {
	font-size: 18px;
	font-weight: bold;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (Untitled-1) -->
<table width="620" height="592" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
	<tr>
	  <td height="317">
	  
	  
	  <table width="620" height="204" border="0" background="bit project/Page/report/images/report_01.png">
          <tr >
            <td><div align="center">
              <h1 class="style1">NAWODAYA INSTITUTE(PVT) LTD </h1>
            </div></td>
          </tr>
          <tr height="10%">
            <td bgcolor="#FFFFFF"> <div align="center" class="style2">No: 66/12, <br>
            Yatiyanthota road,<br>
            Awissawella.
            </div></td>
          </tr>
          <tr>
            <td><div align="center" class="style2">Tel : 036-2230454/Fax : 94-3-2687014<br>
Email : avinavodaya@gmail.com</div></td>
          </tr>
          <tr>
		  <td colspan="3" ><hr color="#000066"></td>
	    </tr>

		  
		  <tr>
		    <td background="images/report_04.png" style="background-repeat:no-repeat">&nbsp;</td>
		  </tr>
          <tr>
            <td height="3" background="bit project/Page/report/images/report_04.png" style="background-repeat:no-repeat">&nbsp;</td>
          </tr>
        </table>
         <?php 
			include'../admin/logic/Classes/examHandler.php';                                    
			
			$xm=new ExamHandler();
			$xm->setCon($con);
			
			$result=$xm->getSubjectProgress($reg,$subgr,$year);
			$time_now=mktime(date('H')+5,date('i')+30,date('s'),date('m'),date('d'),date('Y'));
			$num=mysql_num_rows($result);
			$row=mysql_fetch_array($result); 
		?>
			
	  <table width="620" height="56" border="0" background="bit project/Page/report/images/report_02.png">
<tr><?php if(!($num==0)){ 
	   // check the number of rows are not zero   
			 if(isset($row['marks'])){ ?>
              <td height="29" colspan="9" ><h3 align="center">Students Marks</h3></td>
            </tr>
            
            <tr >
              <td width="58">&nbsp;</td>
              <td width="67"><div align="center"><strong>Reg_no: </strong></div></td>
              <td width="53"><?php echo $reg ;  ?></td>
              <td width="60"><strong>Grade: </strong></td>
              <td width="66"><?php echo $row['grade'];  ?></td>
              <td width="64"><strong>Subject: </strong></td>
              <td width="68"><?php echo $row['subject'];  ?></td>
              <td width="44"><strong>Year :</strong></td>
              <td width="102"><?php echo $year ;  ?></td>
            </tr>
            <tr >
              <td colspan="7">&nbsp;</td>
            </tr>
          </table></td>
	</tr>
	<tr>
		<td bordercolor="#F0F0F0">
		  
	  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr >
          <td colspan="2" bgcolor="#FFFFFF" class="style1"><div align="center" class="style3">Month</div></td>
          <td width="45%" bgcolor="#FFFFFF" class="style1"><div align="center" class="style3">Marks</div></td>
        </tr>
		
        <tr>
          <td colspan="2">&nbsp;</td>
          <td><div align="center"></div></td>
        </tr>
		
        <?php 
		while($row=mysql_fetch_array($result)){ 
				?>
           <tr>
          <td colspan="2" ><div align="center"><?php echo $row['month'];  ?></div></td>
           <td width="21%"><div align="center"><?php echo $row['marks'];  ?></div></td>
              </tr>
            
 		<?php
		} ?> 
		<tr>
		  <td colspan="3"><hr></td>
	    </tr>
      </table>
	  
	  <p>&nbsp;</p>
	  <p>&nbsp;</p>
	  <p>&nbsp;</p>

	  <p>&nbsp;</p>
	  <p>&nbsp;</p>
	  <p>&nbsp;</p>
	  <p>&nbsp;</p>
	  
	  <p>&nbsp;</p></td>
	</tr>
	<tr>
		<td><table width="620" height="42" border="0" background="bit project/Page/report/images/report_03.png">
          <tr>
            <td><div align="left" class="style2">
              <div align="center"></div>
            </div></td>
          </tr>
        </table></td>
	</tr>
</table>
</body>
</html>
<?php  }
}
 else { ?><div align="center"> <strong> There is no record to display. </strong></div><?php }
} 
else 
{
	header("location:../../index.php");
	}
?>

